<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>保存模板</title>
    <s:head/>
</head>
<script type="text/javascript">
    var trailId = "${trail.id}";
    var formSetting = {
        title: "模板命名",
        module: 'save',
        numCount: 1,

        columns: [{
            name: "trail.commonTemplateName",
            label: "模板名"
        }],
        form: {
// 		'url' : 'business-saveAsModel?trail.id='+trailId,
            'url': 'trail-saveAsModel?id=' + trailId,
            'data': function () {
                if (trailId) {
                    var dataValue = "";
                    $.ajax({
                        url: "trail-find?trail.id=" + trailId,
                        async: false,
                        cache: false,
                        success: function (data) {
                            dataValue = data;
                        }
                    });
                    return dataValue;
                } else {
                    return null;
                }
            },
            'ajaxForm': {
                success: function (data) {
                    var msg = $.parseJSON(data.msg).msg;
                    alert(msg);
                    jw.close();
                }
            },
            buttons: {}
        }
    };
    $(document).ready(function () {
        $("#formtable").mrdForm(formSetting);
    });
</script>
<body>
<div style="width: 100%">
    <div id="formtable"></div>
</div>
</body>
</html>
